-
-
Couldn't load subscription status.
- Fork 648
Stop re-adding displayname/avatar fields to leave/ban state events
#5011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop re-adding displayname/avatar fields to leave/ban state events
#5011
Conversation
…e and ban state events Signed-off-by: Ginger <[email protected]>
|
The comment fairly strongly suggests that it does it for a reason though… will this cause, eg. all messages from people who've left to appear with no display name / avatar? Or is this fine because that's kept in the sentinel events? Do all clients actually use them reliably? Also, I know you've not written any new code here but some tests could go a long way to help set out what we think should happen, eg: "member event for left user should not contain display name", "member event on historical message for left user should contain display name" etc. |
I suspect that this code was originally added for the convenience of client developers, so they wouldn't have to add extra logic when looking up the display names and avatars of users which are no longer in the room. However, it also removed the client's ability to choose if those users should have their display names and avatars visible. I believe that deciding if and when to show that data should be the responsibility of the client, not the SDK, because having the SDK silently add the fields back in can cause surprising behavior. In fact, I opened this PR after discovering that Cinny showed the abusive avatar of a banned troll even though the troll's join event was redacted. |
|
To be more specific, here's the scenario I observed:
It might be desirable in the future for |
|
The js-sdk's current behaviour does seem a bit dumb here. While returning no avatar / display name for left users might be argued to be technically correct, if it's going to cause clients to suddenly start displaying left users with no display name or avatar, I don't think this is a thing we can just hit merge on. It would at least be a breaking change. If possible, fixing |
As written this is currently a breaking change, yeah. I'll investigate fixing |
|
Did you get a chance to take a look at this? Just because we'll close this PR if it's not actively being worked on (we can re-open later of course). |
I got distracted by other things, sorry! I'll take a look at it today. |
|
After investigating further, I have determined that the behavior I was observing is likely a bug with the continuwuity homeserver incorrectly returning |
|
This keeps coming up in our weekly syncs as an outstanding PR, so I'm going to close it for the time being. We can always reopen it if needed. |
This PR removes a snippet of code that quietly re-added
displaynameandavatar_urlfields to the cached version ofleaveandbanm.room.memberstate events stored inRoomMemberobjects. This code caused the cached member event to be inconsistent with the actual member event returned by other functions, and also caused the (potentially abusive) avatars and displaynames of banned users to appear in clients which call functions that access the cached data.Checklist
public/exportedsymbols have accurate TSDoc documentation.